package com.v.im.businessservice.controller;

import com.v.im.businessapi.api.ImUserInfoServiceAPI;
import com.v.im.businessapi.dto.paramDTO.ImUserParamDTO;
import com.v.im.businessapi.dto.resultDTO.ImUserResultDTO;
import com.v.im.businessapi.dto.resultDTO.TestUserResultDTO;
import com.v.im.businessservice.bean.ImUserEntity;
import com.v.im.businessservice.controller.base.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author wym
 * @create 2019-01-30 11:00
 **/
@RestController
public class ImUserController extends BaseController implements ImUserInfoServiceAPI {


    @Override
    public ImUserResultDTO getImUserByUserName(String userName) {
        return imUserService.getImUserrInfoByUserName(userName);
    }

    @Override
    public Boolean saveUser(ImUserParamDTO imUserParamDTO) {
        if (imUserParamDTO == null) {
            return false;
        }
        ImUserEntity imUserEntity = new ImUserEntity();
        BeanUtils.copyProperties(imUserParamDTO,imUserEntity);
        return imUserService.saveUserInfo(imUserEntity);
    }

    @Override
    public List<ImUserResultDTO> getImUserResults(String userIds) {
        return imUserService.getImUserResults(userIds);
    }
}
